<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@page import="util.Info" %>
<%@page import="dao.CommDAO" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    CommDAO dao = new CommDAO();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
    <title>新增排班</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <LINK href="admin/css/admin.css" type="text/css" rel="stylesheet">
    <style>
        select {
            width: 150px;
        }
    </style>
</head>
<body>
<form action="/srykzsblmis/studysite?ac=pbadd" name="f1" method="post" onsubmit="return ck()">
    <TABLE cellSpacing=0 cellPadding=0 width="95%" align=center border=0>
        <TR height=20>
            <TD></TD>
        </TR>
        <TR height=22>
            <TD style="PADDING-LEFT: 20px; FONT-WEIGHT: bold; COLOR: #ffffff"
                align=middle background=admin/images/title_bg2.jpg>新增排班
            </TD>
        </TR>
        <TR bgColor=#ecf4fc height=12>
            <TD></TD>
        </TR>
        <TR height=20>
            <TD></TD>
        </TR>
    </TABLE>
    <TABLE cellSpacing=1 cellPadding=2 width="95%" align=center border=0 bgcolor="#cccccc">
        <tr bgcolor="#ffffff">
            <td>科室</td>
            <td>
                <select id="dept" name="dept">
                    <option value="">请选择</option>
                    <%
                        ArrayList<HashMap> deptlist = (ArrayList<HashMap>) dao.select("select * from dept where delstatus='0'");
                        for (HashMap deptm : deptlist) {
                    %>
                    <option value="<%=deptm.get("id") %>"><%=deptm.get("deptname") %>
                    </option>
                    <%} %>
                </select>*
            </td>
        </tr>
        <tr bgcolor="#ffffff">
            <td>医生</td>
            <td>
                <select id="doc" name="doctor_id">
                    <option value="">请选择</option>
                    <%
                        ArrayList<HashMap> doclist = (ArrayList<HashMap>) dao.select("select s.* from sysuser s left join dept d on s.dept = d.id  where s.utype = '医生'");
                        for (HashMap docm : doclist) {
                    %>
                    <option value="<%=docm.get("id") %>"><%=docm.get("tname") %>
                    </option>
                    <%} %>
                </select>*
            </td>
        </tr>
        <tr bgcolor="#ffffff">
            <td>日期</td>
            <td>
                <select id="date" name="shift_date">
                    <option value="">请选择</option>
                    <option value="星期一">星期一</option>
                    <option value="星期二">星期二</option>
                    <option value="星期三">星期三</option>
                    <option value="星期四">星期四</option>
                    <option value="星期五">星期五</option>
                    <option value="星期六">星期六</option>
                    <option value="星期日">星期日</option>
                </select>*
            </td>
        </tr>
        <tr bgcolor="#ffffff">
            <td>时间</td>
            <td>
                <select id="time" name="shift_time">
                    <option value="">请选择</option>
                    <option value="上午">上午</option>
                    <option value="下午">下午</option>
                </select>*
            </td>
        </tr>
        <tr bgcolor="#ffffff">
            <td colspan="2">
                <input type="submit" value="提交"/>
                <input type="reset" value="重置"/>
            </td>
        </tr>
    </TABLE>
</form>
</body>
</html>
<script type="text/javascript">
    function ck() {
        if (f1.dept.value == "") {
            alert("科室不能为空");
            return false;
        }
        if (f1.doc.value == "") {
            alert("医生不能为空");
            return false;
        }
        if (f1.date.value == "") {
            alert("日期不能为空");
            return false;
        }
        if (f1.time.value == "") {
            alert("时间不能为空");
            return false;
        }
    }

    <%
String suc = (String)request.getAttribute("suc");
String no = (String)request.getAttribute("no");
if(no!=null)
{
 %>
    alert("已存在的用户名");
    <%}
   if(suc!=null)
   {
    %>
    alert("操作成功");
    location.replace("/srykzsblmis/admin/pblist.jsp");
    <%}%>
</script>